import numpy as np
import pandas as pd
import qlib
from qlib.data import D
from qlib.data.ops import ElemOperator, PairOperator
from qlib.config import REG_CN






if __name__ == '__main__':
    provider_uri = "~/.qlib/qlib_data/{}".format('index_data')
    qlib.init(provider_uri=provider_uri, region=REG_CN, **{"custom_ops": [PairSlope]})

    instruments = ["sh000300"]
    fields = ["PairSlope($high, $close,18)"]
    print(D.features(instruments, fields, start_time="2010-01-01", end_time="2017-12-31", freq="day"))